function Set-Company {
    param (
        [Parameter(Mandatory=$true)][string]$ServerName,
        [Parameter(Mandatory=$true)][string]$DatabaseName,
        [Parameter(Mandatory=$true)][pscredential]$Credential,
        [Parameter(Mandatory=$true)][string[]]$Companies,
        [Parameter(Mandatory=$false)][switch]$LSC
    )

    Write-Host # Newline.
    if ($Companies.Count -eq 1) {
        Write-Host "Adding company into the LS Insight database..."
    } elseif ($Companies.Count -gt 1) {
        Write-Host "Adding companies into the LS Insight database..."
    }

    # Concatenate all stored procedure calls.
    $Query = ""
    if ($LSC) {
        foreach ($Company in $Companies) {
            $Query += 'EXEC [dbo].[LSInsight$InsertLSCCompany] ' + "'$Company'; "
        }
    } else {
        foreach ($Company in $Companies) {
            $Query += 'EXEC [dbo].[LSInsight$InsertCompany] ' + "'$Company'; "
        }
    }

    # Gather all parameters.
    $params = @{
        ServerInstance = $ServerName
        Database = $DatabaseName
        Username = $Credential.UserName
        Password = ($Credential.Password | ConvertTo-LSPlainText)
        Query = $Query
    }
    
    # Insert every company into LS Insight database.
    Invoke-Sqlcmd @params
}